package com.zs4sdk.entity;

import com.common.library.entity.JSONResultEntity;
import com.common.library.util.Helper;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Jancy on 16/2/15.
 */
public class CompanyEntity extends JSONResultEntity {
    public static final String PUBLISHER = "publisher";

    private int publisher;

    /**
     * 构造方法
     * @param json
     */
    public CompanyEntity(JSONObject json){
        this.fromJSON(json);
    }

    //#region Override方法
    @Override
    public JSONObject toJSON() {
        JSONObject result = super.toJSON();
        try {
            result.put(PUBLISHER, this.publisher);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return result;
    }

    @Override
    public void fromJSON(JSONObject json) {
        super.fromJSON(json);
        if (Helper.isNotEmpty(json)) {
            this.publisher = json.optInt(PUBLISHER);
        }
    }

    public int getPublisher() {
        return publisher;
    }

    public void setPublisher(int publisher) {
        this.publisher = publisher;
    }
}
